package com.yxr.mobileplayer.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

import androidx.annotation.Nullable;

import com.yxr.mobileplayer.R;
import com.yxr.mobileplayer.listener.GameOnClickListener;
import com.yxr.mobileplayer.listener.HistoryOnClickListener;
import com.yxr.mobileplayer.listener.TextSearchedOnClickListener;

/**
 *  com.yxr.mobileplayer.view.TitleBar
 */
public class TitleBar extends LinearLayout {

    private View tv_searched;
    private RelativeLayout rl_game;
    private View iv_history;
    private Context context;
    public TitleBar(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        this.context = context;
    }


    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        //全网搜索文本框
        tv_searched = findViewById(R.id.tv_searched);
        //游戏图标这个布局
        rl_game = findViewById(R.id.rl_game);
        //历史图标
        iv_history = findViewById(R.id.iv_history);
        // 全网搜索文本框设置点击监听
        tv_searched.setOnClickListener(new TextSearchedOnClickListener(context));
        rl_game.setOnClickListener(new GameOnClickListener(context));
        iv_history.setOnClickListener(new HistoryOnClickListener(context));
    }
}
